#pragma once
#ifndef __LIT__META__DATA__INCLUDED__HH__
#define __LIT__META__DATA__INCLUDED__HH__

#include "LitExceptions.h"
#include "LitStream.h"
#ifndef LIT_STANDALONE
#include <OgreStringConverter.h>
#endif
#include <unordered_map>

namespace Lit
{

	class LIT_API MetaData : public Named<true>
	{
		/*friend std::ostream& operator << ( std::ostream & strm, const MetaData& d );
		friend std::istream& operator >> ( std::istream & strm, MetaData& d );*/
	protected:
		String mValue;
		MetaGroup * mParent;
	public:
		MetaData( MetaGroup * parent = NULL );
		MetaData( MetaGroup * parent, const String &name);
		MetaData( MetaGroup * parent, const String &name, const String& val );
		MetaData( const MetaData& rk );
		virtual ~MetaData();
		
		const MetaGroup * MetaData::parent( ) const;
		MetaGroup * MetaData::parent( );
		void setParent( MetaGroup * val );
		void setValue( const String & val );
		
		MetaData& operator= (const MetaData& rk);
		
		const String& getValue( ) const;
		template<typename T>T to( const T & def_val = T() ) const{ return mValue.to<T>(); }
#ifndef LIT_STANDALONE
		template<>Ogre::ColourValue to( const Ogre::ColourValue & def_val) const{ return Ogre::StringConverter::parseColourValue( mValue, def_val ); }
#endif
		template<> String to( const String & def_val ) const{ return mValue; }
	};
}
#endif
